//减法功能-Hook
import { ref, watch } from 'vue';
interface nums {
  num1: number,
  num2: number
}
export function useSub(obj:nums) {
  const subNum = ref(0);
  watch([obj.num1, obj.num2], ([num1, num2]) => {
    subFn(num1, num2);
  });
  const subFn = (num1:number, num2:number) => {
    subNum.value = num1 - num2;
  };
  return {
    subNum,
    subFn,
  };
}
